#ifndef __USB_MDWR_H
#define __USB_MDWR_H

#include "stm32f10x.h"

typedef struct
{
	uint16_t USB_GPIO_Pin;             /*!< Specifies the GPIO pins to be configured.
	                                      This parameter can be any value of @ref GPIO_pins_define */

	GPIOSpeed_TypeDef USB_GPIO_Speed;  /*!< Specifies the speed for the selected pins.
	                                      This parameter can be a value of @ref GPIOSpeed_TypeDef */

	GPIOMode_TypeDef USB_GPIO_Mode;    /*!< Specifies the operating mode for the selected pins.
	                                      This parameter can be a value of @ref GPIOMode_TypeDef */

	GPIO_TypeDef* USB_GPIOx;

	FunctionalState USB_GPIO_State;

	uint32_t USB_RCC_APB2Periph;

}USB_Pullup;

typedef struct
{
	uint8_t* pBufferPointer;
	uint32_t wBufferSize;
}DataForEpInHandler;

#define MDWR_NUM_OUT_EP		0x02 /* The number of output endpoints. */
#define MDWR_NUM_OUT_EP_0	0x00 /* First output endpoint. */
#define MDWR_NUM_OUT_EP_1 	0x01 /* Second output endpoint. */

#define MDWR_NUM_IN_EP		0x02 /* The number of input endpoints. */
#define MDWR_NUM_IN_EP_0	0x00 /* First input endpoint. */
#define MDWR_NUM_IN_EP_1 	0x01 /* Second input endpoint. */


typedef void (*EpOutIrqHandler_t)(uint8_t*, uint8_t);
typedef DataForEpInHandler (*EpInIrqHandler_t)(void);

extern EpOutIrqHandler_t USB_EpOutIrqHandlers[MDWR_NUM_OUT_EP];
extern EpInIrqHandler_t USB_EpInIrqHandlers[MDWR_NUM_IN_EP];

ErrorStatus USB_MDWR_Init(void);
void USB_MDWR_SetEp0TxValid(void);
void USB_MDWR_SetEp1TxValid(void);

#endif /* __USB_MDWR_H */


